Lex SNM2 Network Import
Introduction
This is a full import which will import Labour Rates and Parts Discount for existing suppliers which belong to LEX.
download sample lex snm2 import file.
Fields
LEX SNM2 Network Import
| Column Position | Header Name | Map to ViSN Fields (Description) | Datatype | Validation | Max length | Mandatory | Default Value | Example | 
|---|---|---|---|---|---|---|---|---|
| 1 | SNM1 | IGNORE(This field will not be imported) | No | |||||
| 2 | RecordVersionNo | IGNORE(This field will not be imported) | No | |||||
| 3 | 1LinkSiteReference | DI Group ID - DI Supplier ID | String | A-Z, 0-9 and hyphen(Hyphen is mandatory and should have strings containing A-Z,0-9 before and after it) | 50 | Yes | ALRbwQqIVhr0wBjWu0Wp-lIi9PzxKgG9GahqAf4HM | |
| 4 | Scheme | IGNORE(This field will not be imported) | No | |||||
| 5 | ServiceCentreName | IGNORE(This field will not be imported) | No | |||||
| 6 | SupplierAccountReference | Supplier ID | String | A-Z ,0-9 | 20 | Yes | 020237 | |
| 7 | FranchiseHeld | Manufacturer code | String | A-Z ,0-9 and all special characters | 30 | Yes | B4 | |
| 8 | Preference | IGNORE(This field will not be imported) | No | |||||
| 9 | ExpectedLabourRate | Labour Rate Car / Labour Rate LCV / Labour Rate EV | String | 0-9 and . (decimal number) | 6 | Yes | 4.5 | |
| 10 | ExpectedPartsDiscount | Parts Discount | String | 0-9 and . (decimal number) | 5 | No | 94.5 | |
| 11 | ReviewDate | IGNORE(This field will not be imported) | No | |||||
| 12 | 33++ | IGNORE(This field will not be imported) | No | 
Prerequisites and how the import works
- 
This is a full import in which the supplier Id, Labour Rate Car or Labour Rate LCV or Labour Rate EV and parts discount will be imported.
 - 
The 1LinkSiteReference(Column C) is the combination of DI Group Id and DI supplier Id which will be used to update these values for a supplier and they will be imported in the lease supplier level
 - 
The franchise and vehicle type should be already present against the franchises in the lease supplier level. The manufacturer code(FranchiseHeld - Column F) in the csv will be used to find the existence of franchise and corresponding vehicle type against the supplier.
 - 
A row will be skipped if a matching franchise is not found against the supplier or if the 1LinkSiteReference doesn't have a valid DI Group Id and DI supplier Id.
 
Importing a file
Preparation
- 
Create a new branch with Jira task number in the branch name
 - 
Delete all the files within the importFiles folder to prevent accidental import of incorrect files
 - 
Create a folder with the current sprint number
 - 
Copy the file that needs to be imported
 - 
Go to
package.json, find the linevalidate:lex-snm2-network-import - 
Modify
--leaseIdwith the required lease Id - 
Modify
--filewith the relative path of the file - 
Save the package.json
 
Validating locally
- 
in a terminal run
npm run build - 
in a terminal run
npm run validate:lex-snm2-network-import - 
If there are no errors, push the code
 
Validating in workflow
- 
Go to Action of Import-manger
 - 
Find
<Environment> - on-demand-import - 
Select the branch that was created for this import
 - 
Enter script name as
validate:lex-snm2-network-import - 
Leave Overrides empty or you can specify --leaseId or --file if required
 

Importing the file
- 
If the validation has passed
 - 
Go to Action of Import-manger
 - 
Find
<Environment> - on-demand-import - 
Select the branch that was created for this import
 - 
Enter script name as
validate:lex-snm2-network-import - 
Enter
--persistin Overrides field 

Importing and validating the file via cloud run
Creating Schedulers for validating the Lex SNM2 delta file
- Go to Cloud Scheduler and select the CREATE JOB
 
Setup Required
A Scheduler should be created cloud scheduler with the following parameters
- Name: lex-snm2-network-validation
 - Region: europe-west2
 - Frequency: 0 0 31 12 1
 - TimeZone: GMT London
 - Target type: HTTP
 - URL: https://import-manager-36r2bu4izq-uc.a.run.app/lex-snm2-network-import
 - HTTP method: POST
 - Auth header: select OIDC token
 - Service account: cloud-run-import-customer-contract
 - body: a JSON object including the following parameters
 
JSON object for lex-snm2-network-validation scheduler
{
  "persist": "false",
  "bucket": "biddirect-2.appspot.com",
  "appDirectory": "/usr/src/app/",
  "importPath": "imports/fileDrop/",
  "importFileDropPath": "imports/fileDrop/",
  "importFileName": "SNM2-full-labour-rates.csv",
  "email": "mailgun@digitalinnk.com",
  "fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
  "leaseId": "QJKgdjS4I02sEia4yTne"
}
Create scheduler for validating Lex SNM2 file



Creating Schedulers for importing the Lex SNM2 file
- Go to Cloud Scheduler and select the CREATE JOB
 
Setup Required
A Scheduler should be created cloud scheduler with the following parameters
- Name: lex-snm2-network-import
 - Region: europe-west2
 - Frequency: 0 0 31 12 1
 - TimeZone: GMT London
 - Target type: HTTP
 - URL: https://import-manager-36r2bu4izq-uc.a.run.app/lex-snm2-network-import
 - HTTP method: POST
 - Auth header: select OIDC token
 - Service account: cloud-run-import-customer-contract
 - body: a JSON object including the following parameters
 
JSON object for lex-snm2-network-import scheduler
{
  "persist": "true",
  "bucket": "biddirect-2.appspot.com",
  "appDirectory": "/usr/src/app/",
  "importPath": "imports/fileDrop/",
  "importFileDropPath": "imports/fileDrop/",
  "importFileName": "SNM2-full-labour-rates.csv",
  "email": "mailgun@digitalinnk.com",
  "fatalErrorEmailToAddress": "mailgun@digitalinnk.com"
}
Create scheduler for importing Lex SNM2 file



Preparation:
- Bucket name is 
biddirect-2.appspot.comand it will vary for higher envs and the file path should beimports/fileDrop, where you can drop the the CSV file named "SNM2-full-labour-rates.csv". This action will place the file in the specified location within the designated bucket. 

Validation:
- Go to Cloud Scheduler
 - Run lex-snm2-network-validation job
 
Importing:
- Go to Cloud Scheduler
 - Run lex-snm2-network-import job
 

logs in cloud

Testing
- Supplier Id, labour rate for Car, LCV or EV and parts discount will be updated in the supplier config screen for lex customer.
 

Status: Pending Approval
Category: Protected
Authored By: Vignesh Kanthimathinathan on Nov 11, 2024